/**
 * Created by x on 17-8-10.
 */
angular.module('rentInfo',[]).component(
    'rentInfo',
    {
        templateUrl: 'component/rent_info/rent_info.template.html',
        controller: [
            '$scope', 'Api','Alert', '$state','$stateParams', function ($scope, Api,Alert, $state,$stateParams) {

                getRentlistInfo()
                function getRentlistInfo() {
                    var sourceId=$stateParams.apartmentId;
                    Api.getRentlistInfo(sourceId,function (result) {
                        // console.log(result)
                        if(result.data !== null){
                            getRentprotocolInfo(result.data.id)
                        }

                    });
                }

                function getRentprotocolInfo(id) {
                    Api.getRentprotocolInfo(id,function (result) {
                        // console.log(result)
                        $scope.rentProtocal = result.data;
                    });

                }



            }
        ]

    }
);